﻿@inherits RootLayout
@*<div>元素需要加上 tabindex 才能触发键盘事件*@
@*https://github.com/dotnet/aspnetcore/issues/11137*@
@attribute [Obsolete]
<div id="app"
     @ref="RootWrapper">
    <CascadingValue Value="this" IsFixed>
        @Body
        <IndexLoading Loading="@(!AppSession.Loaded)" Title="正在初始化..."></IndexLoading>
    </CascadingValue>
</div>
@code {
    [Inject,NotNull] IAppSession? AppSession { get; set; }
    protected override async Task OnInitializedAsync()
    {
        await base.OnInitializedAsync();
        await AppSession.NotifyLoginSuccessAsync();
        await AppSession.RouterStore.InitMenusAsync(null);
        var url = AppSession.Navigator.ToBaseRelativePath(AppSession.Navigator.Uri);
        AppSession.Navigator.NavigateTo(url);
    }
}